package cz.muni.fi.pa165.languageschool.rest;

import cz.muni.fi.pa165.languageschool.dto.CourseTO;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * REST Course resource
 *
 * @author Michal Fucik (3956224) michal.fuca.fucik(at)gmail.com
 */
@XmlRootElement
public class CourseResource extends CourseTO {

    public CourseResource(CourseTO cto) {
        setId(cto.getId());
        setCode(cto.getCode());
        setName(cto.getName());
        setRequiredLevel(cto.getRequiredLevel());
        setTaughtLanguage(cto.getTaughtLanguage());
        setRelatedLectures(cto.getRelatedLectures());
    }

    public CourseResource() {
    }

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String getPlain() {
        return this.toString();
    }
}
